<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Faiss: faiss::ThreadedIndex&lt; IndexT &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Faiss
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacefaiss.html">faiss</a></li><li class="navelem"><a class="el" href="classfaiss_1_1ThreadedIndex.html">ThreadedIndex</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-static-methods">Static Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="classfaiss_1_1ThreadedIndex-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">faiss::ThreadedIndex&lt; IndexT &gt; Class Template Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="ThreadedIndex_8h_source.html">ThreadedIndex.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for faiss::ThreadedIndex&lt; IndexT &gt;:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classfaiss_1_1ThreadedIndex.png" usemap="#faiss::ThreadedIndex&lt; IndexT &gt;_map" alt=""/>
  <map id="faiss::ThreadedIndex&lt; IndexT &gt;_map" name="faiss::ThreadedIndex&lt; IndexT &gt;_map">
<area href="classfaiss_1_1IndexReplicasTemplate.html" alt="faiss::IndexReplicasTemplate&lt; IndexT &gt;" shape="rect" coords="0,112,233,136"/>
<area href="structfaiss_1_1IndexShardsTemplate.html" alt="faiss::IndexShardsTemplate&lt; IndexT &gt;" shape="rect" coords="243,112,476,136"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ac603a659e678e154a49722bc428538e9"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac603a659e678e154a49722bc428538e9"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>ThreadedIndex</b> (bool threaded)</td></tr>
<tr class="separator:ac603a659e678e154a49722bc428538e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a52a2c216ed16feb3be6a57e15253b368"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a52a2c216ed16feb3be6a57e15253b368"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>ThreadedIndex</b> (int d, bool threaded)</td></tr>
<tr class="separator:a52a2c216ed16feb3be6a57e15253b368"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9a11a672369d48f45cf1dd1bfe0dad87"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1ThreadedIndex.html#a9a11a672369d48f45cf1dd1bfe0dad87">addIndex</a> (IndexT *index)</td></tr>
<tr class="separator:a9a11a672369d48f45cf1dd1bfe0dad87"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a21604d6b8b8d42e6cc78c26e85564027"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1ThreadedIndex.html#a21604d6b8b8d42e6cc78c26e85564027">removeIndex</a> (IndexT *index)</td></tr>
<tr class="separator:a21604d6b8b8d42e6cc78c26e85564027"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a30ade89dc4e571868cf121e5592d6687"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1ThreadedIndex.html#a30ade89dc4e571868cf121e5592d6687">runOnIndex</a> (std::function&lt; void(int, IndexT *)&gt; f)</td></tr>
<tr class="separator:a30ade89dc4e571868cf121e5592d6687"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ada80f2e3319c96d9b0efb0259c8bbd5e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ada80f2e3319c96d9b0efb0259c8bbd5e"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>runOnIndex</b> (std::function&lt; void(int, const IndexT *)&gt; f) const </td></tr>
<tr class="separator:ada80f2e3319c96d9b0efb0259c8bbd5e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4536f6e7a8cce1f79bebc420ae1e909b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1ThreadedIndex.html#a4536f6e7a8cce1f79bebc420ae1e909b">reset</a> () override</td></tr>
<tr class="separator:a4536f6e7a8cce1f79bebc420ae1e909b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a25aac2b3024e7f900687f85f625afaba"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a25aac2b3024e7f900687f85f625afaba"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1ThreadedIndex.html#a25aac2b3024e7f900687f85f625afaba">count</a> () const </td></tr>
<tr class="memdesc:a25aac2b3024e7f900687f85f625afaba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of sub-indices. <br/></td></tr>
<tr class="separator:a25aac2b3024e7f900687f85f625afaba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9d150a2d26d97b703af2a78e0c564c0e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9d150a2d26d97b703af2a78e0c564c0e"></a>
IndexT *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1ThreadedIndex.html#a9d150a2d26d97b703af2a78e0c564c0e">at</a> (int i)</td></tr>
<tr class="memdesc:a9d150a2d26d97b703af2a78e0c564c0e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the i-th sub-index. <br/></td></tr>
<tr class="separator:a9d150a2d26d97b703af2a78e0c564c0e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae84b4b14209700f372b9a82b78123f1a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae84b4b14209700f372b9a82b78123f1a"></a>
const IndexT *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1ThreadedIndex.html#ae84b4b14209700f372b9a82b78123f1a">at</a> (int i) const </td></tr>
<tr class="memdesc:ae84b4b14209700f372b9a82b78123f1a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the i-th sub-index (const version) <br/></td></tr>
<tr class="separator:ae84b4b14209700f372b9a82b78123f1a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a33201cb008802a729f61c76d519cb58a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a33201cb008802a729f61c76d519cb58a"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1ThreadedIndex.html#a33201cb008802a729f61c76d519cb58a">own_fields</a></td></tr>
<tr class="memdesc:a33201cb008802a729f61c76d519cb58a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Whether or not we are responsible for deleting our contained indices. <br/></td></tr>
<tr class="separator:a33201cb008802a729f61c76d519cb58a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:abdcae15f8589c53d4fa648fb2d5ab625"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abdcae15f8589c53d4fa648fb2d5ab625"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1ThreadedIndex.html#abdcae15f8589c53d4fa648fb2d5ab625">onAfterAddIndex</a> (IndexT *index)</td></tr>
<tr class="memdesc:abdcae15f8589c53d4fa648fb2d5ab625"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called just after an index is added. <br/></td></tr>
<tr class="separator:abdcae15f8589c53d4fa648fb2d5ab625"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3bfc1a3002a150d850b20dc40c5d31fe"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3bfc1a3002a150d850b20dc40c5d31fe"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1ThreadedIndex.html#a3bfc1a3002a150d850b20dc40c5d31fe">onAfterRemoveIndex</a> (IndexT *index)</td></tr>
<tr class="memdesc:a3bfc1a3002a150d850b20dc40c5d31fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called just after an index is removed. <br/></td></tr>
<tr class="separator:a3bfc1a3002a150d850b20dc40c5d31fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-static-methods"></a>
Static Protected Member Functions</h2></td></tr>
<tr class="memitem:a26c2b3a37f612f8654a855831ad828a6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a26c2b3a37f612f8654a855831ad828a6"></a>
static void&#160;</td><td class="memItemRight" valign="bottom"><b>waitAndHandleFutures</b> (std::vector&lt; std::future&lt; bool &gt;&gt; &amp;v)</td></tr>
<tr class="separator:a26c2b3a37f612f8654a855831ad828a6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:acb0dc6a321ad80636d5fef5cc7edd05b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acb0dc6a321ad80636d5fef5cc7edd05b"></a>
std::vector&lt; std::pair&lt; IndexT <br class="typebreak"/>
*, std::unique_ptr<br class="typebreak"/>
&lt; <a class="el" href="classfaiss_1_1WorkerThread.html">WorkerThread</a> &gt; &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1ThreadedIndex.html#acb0dc6a321ad80636d5fef5cc7edd05b">indices_</a></td></tr>
<tr class="memdesc:acb0dc6a321ad80636d5fef5cc7edd05b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Collection of <a class="el" href="structfaiss_1_1Index.html">Index</a> instances, with their managing worker thread if any. <br/></td></tr>
<tr class="separator:acb0dc6a321ad80636d5fef5cc7edd05b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1031b2c900e9ba53573e617539b3c488"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1031b2c900e9ba53573e617539b3c488"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1ThreadedIndex.html#a1031b2c900e9ba53573e617539b3c488">isThreaded_</a></td></tr>
<tr class="memdesc:a1031b2c900e9ba53573e617539b3c488"><td class="mdescLeft">&#160;</td><td class="mdescRight">Is this index multi-threaded? <br/></td></tr>
<tr class="separator:a1031b2c900e9ba53573e617539b3c488"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename IndexT&gt;<br/>
class faiss::ThreadedIndex&lt; IndexT &gt;</h3>

<p>A holder of indices in a collection of threads The interface to this class itself is not thread safe </p>

<p>Definition at line <a class="el" href="ThreadedIndex_8h_source.html#l00021">21</a> of file <a class="el" href="ThreadedIndex_8h_source.html">ThreadedIndex.h</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a9a11a672369d48f45cf1dd1bfe0dad87"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename IndexT &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classfaiss_1_1ThreadedIndex.html">faiss::ThreadedIndex</a>&lt; IndexT &gt;::addIndex </td>
          <td>(</td>
          <td class="paramtype">IndexT *&#160;</td>
          <td class="paramname"><em>index</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>override an index that is managed by ourselves. WARNING: once an index is added, it becomes unsafe to touch it from any other thread than that on which is managing it, until we are shut down. Use runOnIndex to perform work on it instead. </p>

<p>Definition at line <a class="el" href="ThreadedIndex-inl_8h_source.html#l00049">49</a> of file <a class="el" href="ThreadedIndex-inl_8h_source.html">ThreadedIndex-inl.h</a>.</p>

</div>
</div>
<a class="anchor" id="a21604d6b8b8d42e6cc78c26e85564027"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename IndexT &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classfaiss_1_1ThreadedIndex.html">faiss::ThreadedIndex</a>&lt; IndexT &gt;::removeIndex </td>
          <td>(</td>
          <td class="paramtype">IndexT *&#160;</td>
          <td class="paramname"><em>index</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Remove an index that is managed by ourselves. This will flush all pending work on that index, and then shut down its managing thread, and will remove the index. </p>

<p>Definition at line <a class="el" href="ThreadedIndex-inl_8h_source.html#l00088">88</a> of file <a class="el" href="ThreadedIndex-inl_8h_source.html">ThreadedIndex-inl.h</a>.</p>

</div>
</div>
<a class="anchor" id="a4536f6e7a8cce1f79bebc420ae1e909b"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename IndexT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classfaiss_1_1ThreadedIndex.html">faiss::ThreadedIndex</a>&lt; IndexT &gt;::reset </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">override</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p><a class="el" href="structfaiss_1_1Index.html">faiss::Index</a> API All indices receive the same call </p>

<p>Definition at line <a class="el" href="ThreadedIndex-inl_8h_source.html#l00156">156</a> of file <a class="el" href="ThreadedIndex-inl_8h_source.html">ThreadedIndex-inl.h</a>.</p>

</div>
</div>
<a class="anchor" id="a30ade89dc4e571868cf121e5592d6687"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename IndexT &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classfaiss_1_1ThreadedIndex.html">faiss::ThreadedIndex</a>&lt; IndexT &gt;::runOnIndex </td>
          <td>(</td>
          <td class="paramtype">std::function&lt; void(int, IndexT *)&gt;&#160;</td>
          <td class="paramname"><em>f</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Run a function on all indices, in the thread that the index is managed in. Function arguments are (index in collection, index pointer) </p>

<p>Definition at line <a class="el" href="ThreadedIndex-inl_8h_source.html#l00119">119</a> of file <a class="el" href="ThreadedIndex-inl_8h_source.html">ThreadedIndex-inl.h</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>/data/users/hoss/faiss/<a class="el" href="ThreadedIndex_8h_source.html">ThreadedIndex.h</a></li>
<li>/data/users/hoss/faiss/<a class="el" href="ThreadedIndex-inl_8h_source.html">ThreadedIndex-inl.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
